import axios from 'axios'
import {store} from '../store'

export const baseURL='http://127.0.0.1:8080'
const requests=axios.create({
    baseURL,
    timeout:5000
})

requests.interceptors.request.use((config)=>{
    const Store=store()
    config.headers['Authorization']=Store.token
    return config
},function(error){
    return Promise.reject(error)
})

requests.interceptors.response.use((res)=>{
    return res.data
},(error)=>{

})

export default requests